//
//  StudentAddView.m
//  UI11_Address
//
//  Created by dllo on 15/10/24.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "StudentAddView.h"

@interface StudentAddView ()

@property (nonatomic, retain)UILabel *nameLabel;
@property (nonatomic, retain)UILabel *phoneLabel;
@property (nonatomic, retain)UILabel *genderLabel;

@end


@implementation StudentAddView


- (void)dealloc
{
    
    [_headImageView release];
    [_backGroundImageView release];
    [_genderField release];
    [_phoneField release];
    [_genderField release];
    [_phoneLabel release];
    [_genderLabel release];
    [_nameLabel release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self ceateSubView];
    }
    return self;
}

-(void)ceateSubView
{
    
    //背景图片
    self.backGroundImageView = [[UIImageView alloc] initWithFrame:self.bounds];
    self.backGroundImageView.alpha = 0.6;
    [self addSubview:self.backGroundImageView];
    [_backGroundImageView release];
    
    
    //头像详图
    self.headImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 150, 150, 180)];
    self.headImageView.image = [UIImage imageNamed:@"7.jpg"];
    self.headImageView.userInteractionEnabled = YES;
    [self addSubview:self.headImageView];
    [_headImageView release];
    
    
    
    //姓名Label
    self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(170, 150, 60, 30)];
    //    self.nameLabel.backgroundColor = [UIColor whiteColor];
    self.nameLabel.text = @"姓名 :";
    self.nameLabel.textAlignment = NSTextAlignmentRight;
    [self addSubview:self.nameLabel];
    [_nameLabel release];
    
    //电话Label
    self.phoneLabel = [[UILabel alloc]initWithFrame:CGRectMake(170, 220, 60, 30)];
    //    self.phoneLabel.backgroundColor = [UIColor whiteColor];
    self.phoneLabel.text = @"电话号:";
    self.phoneLabel.textAlignment =  NSTextAlignmentRight ;
    [self addSubview:self.phoneLabel];
    [_phoneLabel release];
    
    //性别Label
    self.genderLabel = [[UILabel alloc]initWithFrame:CGRectMake(170, 290, 60, 30)];
    //    self.genderLabel.backgroundColor = [UIColor whiteColor];
    self.genderLabel.text = @"性别 :";
    self.genderLabel.textAlignment =  NSTextAlignmentRight ;
    [self addSubview:self.genderLabel];
    [_genderLabel release];
    
    
    
    //姓名输入框
    self.nameField = [[UITextField alloc]initWithFrame:CGRectMake(235, 150, 130, 30)];
    self.nameField.backgroundColor = [UIColor clearColor];
    self.nameField.borderStyle = UITextBorderStyleRoundedRect;
    [self addSubview:self.nameField];
    [_nameField release];
    
    //电话输入框
    self.phoneField = [[UITextField alloc]initWithFrame:CGRectMake(235, 220, 130, 30)];
    self.phoneField.backgroundColor = [UIColor clearColor];
    self.phoneField.borderStyle = UITextBorderStyleRoundedRect;
    self.phoneField.keyboardType = UIKeyboardTypeNumberPad;
    [self addSubview:self.phoneField];
    [_phoneField release];
    
    //性别输入框
    self.genderField = [[UITextField alloc]initWithFrame:CGRectMake(235, 290, 130, 30)];
    self.genderField.backgroundColor = [UIColor clearColor];
    self.genderField.borderStyle = UITextBorderStyleRoundedRect;
    [self addSubview:self.genderField];
    [_genderField release];
    
    //轻拍手势
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction:)];
    [self.headImageView addGestureRecognizer:tap];
    [tap release];
    
}


#pragma mark -- 轻拍方法
-(void)tapAction:(UITapGestureRecognizer *)tap
{
    [self.studentAddDelegate presentToViewController];
}


#pragma mark -- 收回键盘方法
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self.nameField resignFirstResponder];
    [self.phoneField resignFirstResponder];
    [self.genderField resignFirstResponder];
}






/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
